Skip to content

[CodeQuality] Skip not inline comparison identical on RepeatedOrEqualToInArrayRector#7402

Closed
samsonasik wants to merge 3 commits intomainfrom
skip-not-inline
Closed

[CodeQuality] Skip not inline comparison identical on RepeatedOrEqualToInArrayRector#7402
samsonasik wants to merge 3 commits intomainfrom
skip-not-inline

Conversation

@samsonasik
Copy link
Member

This avoid use of $this->betterNodeFinder->findInstanceOf() as it can search too deep, use inline search left right instead.

@samsonasik
Copy link
Member Author

Closing for now, it seems cause mixed comparison:

if ($someVariable === 'a' || $someVariable == 'b' || $someVariable === 'c') {

got strict in_array($someVariable, ['a', 'b', 'c'], true) which probably should just be skipped.

@samsonasik samsonasik closed this Oct 3, 2025
@samsonasik samsonasik deleted the skip-not-inline branch October 3, 2025 00:17
@samsonasik
Copy link
Member Author

samsonasik commented Oct 3, 2025

The result seems equal for this mix condition between identical and equal

if ($someVariable === 'a' || $someVariable == 'b' || $someVariable === 'c') {

seems possibly needs check:

if ($identicals !== [] && $equals !== []) {
    return null;
}

needs check more on projects.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant